<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./font_3366928_6aytrri25q9/iconfont.css">

    <link rel="stylesheet" href="./css/商品跳转详情页.css">

    <script src="./js/jquery.min.js"></script>
</head>
<style>
   
</style>
<body>

    <div class="head">
        
        <i class="iconfont icon-xinlangweibo"></i>
        <span>万锋智慧</span>
        <i class="iconfont icon-xiazai"></i>

    </div>
      <div class="sou">
    <input placeholder="请输入你想比价的产品">
    <button>搜 索</button>

      </div>

      <div class="g">
        <span>首页></span>
        <span>电视></span>
        <span>乐视</span>

        <button>筛选</button>
      </div>
    <div class="box">
        <!-- <img src="../瀑布流/1.jpg">
        <p>乐视TV乐视乐视乐视乐视乐视乐视乐视乐视乐视乐视乐视乐视</p>
        <span></span>
        <span></span> -->

    </div>


   
        <ul class="kk">
            <!-- <li> -->
                 <!-- <h4>网友评价</h4>
        <span class="s1">borr</span>
        <span class="s2">2016/10/12</span>
        <span class="s3">购买自京东</span>
        <p>我叫阿俊卡卡挖掘挖掘案件挖掘我怕将物品爱豆爱戴的排毒排我大盘澳网i大批调派军队迫击炮伟大</p> -->
            <!-- </li> -->
           
            </ul>
        
        
<script>
    var productid=localStorage.getItem('productid')
    console.log(productid)
var box=document.querySelector('.box')
    let xhr1=new XMLHttpRequest()
        xhr1.open('get',`http://chst.vip:1234/api/getproduct?productid=${productid}`,true,)
        xhr1.onload=function(){

            if(xhr1.status===200){
                var res2=JSON.parse(xhr1.responseText)
                //  console.log(res2.result)
            let regExp = /^<[^<]+\s+src="([^''""]*)"/;

                 var lis2=''
        
                 res2.result.forEach(function(so,ind){
                 let tu = res2.result[ind].productImg.match(regExp)[1];

                lis2+=`
               
                         <img src="${tu}" class="yy">
                  
                        <span class="hea">${so.productName}</span>
                        <span class='sp1'>当前最低￥6000</span>
                        <span class='sp2'>优选评论 8260条</span>
                     
                        <span class='sp3'>${so.bjShop}</span>
                        
                     
                  
               `
            })
            }
            box.innerHTML=lis2

    
               }
           
        
   
        xhr1.send()


        var k=document.querySelector('.k')
        var kk=document.querySelector('.kk')
        let xhr2=new XMLHttpRequest()
        xhr2.open('get',`http://chst.vip:1234/api/getproductcom?productid=${productid}`,true,)
        xhr2.onload=function(){

            if(xhr2.status===200){
                var res3=JSON.parse(xhr2.responseText)
                //  console.log(res3.result)
            var lis3=''
           
          


            res3.result.forEach(function(sos,ind){
          
              lis3+=`
                 <li>
                  <h4>网友评价</h4>
                  <span class="s1">${sos.comName}</span>
                  <span class="s2">${sos.comTime}</span>
                  <span class="s3">${sos.comFrom}</span>
                  <p>${sos.comContent}</p>
                   </li>
                
                     `
            })
            kk.innerHTML=lis3
        }}
        xhr2.send()


   $('.g span:nth-of-type(1)').click(function(){
    location.href="./商品首页.html"
   })
   $('.g span:nth-of-type(2)').click(function(){
    location.href="./商品跳转2.html"

   })
</script>
</body>
</html>